from sqlalchemy import Column, ForeignKey, DateTime
from sqlalchemy.dialects.oracle import VARCHAR2, NUMBER
from sqlalchemy.orm import relationship
from app.db.base import Base
from datetime import datetime, timezone


class Permission(Base):
    __tablename__ = "PERMISSIONS"
    __table_args__ = {'schema': 'COOP_APP'}

    permission_id = Column(NUMBER, primary_key=True, index=True)
    module_name = Column(VARCHAR2(100), nullable=False)
    action = Column(VARCHAR2(50), nullable=False)

    users = relationship("UserPermission", back_populates="permission")
